const express=require('express');
const router=express.Router();
const pool=require('../pool.js')
module.exports=router;
//轮播图
//测试地址:http://127.0.0.1:8080/v1/index.php/banner
router.get('/banner',(req,res,next)=>{
    pool.query('select * from banner',(err,result)=>{
         if(err){
        	  next(err);
        	  return;
        	}
        	//console.log(result);
        	if(result.length===0){
        	  res.send({code:501,msg:'该轮播图列表无'});
        	}else{
        	  res.send({code:200,msg:'查找成功',data:result});
        	}	
    })
})